home *** CD-ROM | disk | FTP | other *** search
- Path: rocannon.cam.harlequin.co.uk!markt
- From: markt@harlqn.co.uk (Mark Tillotson)
- Newsgroups: comp.object,comp.lang.c++,comp.lang.java
- Subject: Re: Java: What's the Big Deal? (GC)
- Date: 01 Apr 96 20:02:03 GMT
- Organization: Harlequin Limited, Cambridge, England
- Message-ID: <MARKT.96Apr1200203@atlas.harlqn.co.uk>
- References: <4jk4ee$7ri@newsbf02.news.aol.com> <1996Apr1.155416.12816@schbbs.mot.com>
- NNTP-Posting-Host: atlas
- In-reply-to: shang@corp.mot.com's message of Mon, 1 Apr 1996 15:54:16 GMT
-
- shang@corp.mot.com (David L. Shang) wrote:
- >
- > The more a program depends on GC, the more likely it will exhaust memory;
- > because the storage is collected only when all its references are
- > no longer valid, not at the time when all its references are no longer
- > used.
- In complex software this is not true... explicit management of
- storage places such a burden on the programmer that either security is
- compromised (catastrophic bugs) or space leaks occur (that a GC would
- easily have caught). In a GC-based system you only have to debug the
- GC, not every single program that calls free() !!
-
- > Be careful, never make a variable's lifetime unecessarily longer
- > than the required.
- This advice for avoiding space leaks happens to be valid _whether or
- not_ automatic GC is in operation!
-
- > With Java's array, memory will be smashed into millions of small
- > pieces. Here is a brief comparison:
-
- <array of struct of 3 floats example omitted>
-
- On many machines one load instruction is cheaper than multiplying an
- index by 3, so Java's approach is actually faster (other things being
- equal)... Object allocation rarely costs a significant proportion of
- execution time, unless the application fails to do anything useful
- with what it allocates!!
-
- I suggest investigating the GC FAQ at
- http://www.centerline.com/people/chase/GC/GC-faq.html
-
- __Mark
- [ markt@harlequin.co.uk | http://www.harlequin.co.uk/ | +44 1223 873829 ]
- [ homepage http://www.hal.com/services/juggle/home/markt@harlequin.co.uk/ ]
-